package utils

import org.apache.commons.io.FileUtils

import java.io.File
import scala.concurrent.{Await, Future}
import scala.concurrent.duration.Duration

/**
 * Created by yz on 28/10/2021
 */
object Utils {

  def isWindows = {
    System.getProperty("os.name") match {
      case x if x.contains("Windows") => true
      case _ => false
    }
  }

  def execFuture[T](f: Future[T]): T = {
    Await.result(f, Duration.Inf)
  }

  def deleteDirectory(direcotry: File) = {
    try {
      FileUtils.deleteDirectory(direcotry)
    } catch {
      case _ =>
    }
  }

}
